<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      var myMath = {
        pi: 3.14,
        max: function (arr) {
          if (arr === undefined) {
            return -Infinity
          }
          max = arr[0]
          for (var i = 1; i <= arr.length; i++) {
            if (max < arr[i]) {
              max = arr[i]
            }
          }
          return max
        },
        min: function (arr) {
          if (arr === undefined) {
            return Infinity
          }
          max = arr[0]
          for (var i = 1; i <= arr.length; i++) {
            if (max > arr[i]) {
              max = arr[i]
            }
          }
          return max
        },
      }
      var a = [123, 123123, 4124, 132, 2312, 343]
      console.log(myMath.max(a))
    </script>
  </body>
</html>
